# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: main.py
# Time: 14:22

import os

import pytest

from bin.script.write_case import WireCase
from bin.script.write_case_yaml import WriteCaseYaml
from bin.util.file_utils import get_time_report, get_crm_dir,get_chlsj_dir
from bin.util.log_utils import GenerateLog

class MainRun():
    def __init__(self):
        self.allure = os.path.join(get_time_report(), "allure")
        WriteCaseYaml(GenerateLog().logger(),get_chlsj_dir()).write_case()
        WireCase(GenerateLog().logger()).write_case()
        self.allure_report = os.path.join(get_time_report(), "allure_report")

    def run(self):

        pytest.main(["-s", "-v", get_crm_dir("testcase"), "--alluredir", self.allure])
        os.system(f"allure generate {self.allure} -o {self.allure_report} --clean")

if __name__ == '__main__':
    MainRun().run()